<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/User.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<mesoBoard.Data.Message>>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

        <fieldset>
            <legend><%= Html.ThemeImage("arrow_right.png")%> Sent Messages</legend>

            <table class="form_table">

                <tr>
                    <th style="width: 20px"></th>
                    <th>To</th>
                    <th>Subject</th>
                    <th>Message</th>
                    <th style="width: 130px">Date</th>
                </tr>
                <% if (Model.Count() > 0) {
                       int i = 0;
                       foreach (var msg in Model) { %>
                            <tr class="<%= i++ % 2 == 0 ? "" : "bg_color3" %>">
                                <td style="width: 5px"><img src="<%= Url.ThemeContent("~/Images/sent_message.png") %>" alt="Sent Message" /></td>
                                <td style="width: 120px"><%= Html.ActionLink(msg.UserTo.Username, "UserProfile", "Members", new { UserNameOrID = msg.UserTo.Username }, null)%></td>
                                <td>
                                    <a href="<%= Url.Action("ViewMessage", new {MessageID = msg.MessageID}) %>">
                                    <%= msg.Subject.Shorten(18) %>
                                </td>
                                <td>
                                    <a href="<%= Url.Action("ViewMessage", new {MessageID = msg.MessageID}) %>">
                                    <%= msg.Text.Shorten(40)%>
                                    </a>
                                </td>
                                <td><%= Html.RelativeDate(msg.DateSent) %></td>
                            </tr>
                     <%}
                   } else { %>
                   <tr><td colspan="5" align="center">No Sent Messages</td></tr>
                <% } %>
            </table>

        </fieldset>
        
</asp:Content>
